package cn.xjy.ddlc;

import cn.xjy.ddlc.config.DBConnectionConfig;
import cn.xjy.ddlc.output.Displayer;
import cn.xjy.ddlc.output.HTMLDisplayer;
import cn.xjy.ddlc.model.Database;
import lombok.extern.slf4j.Slf4j;

/***
 * 比较器启动
 */
@Slf4j
public class Boots {
    public static void main(String[] args) {
        DatabaseStructureLoader databaseStructureLoader = new DatabaseStructureLoader();
        
        DatabaseComparator comparator = new DatabaseComparator();
        Displayer displayer = new HTMLDisplayer();
        comparator.setDisplayer(displayer);
        long start = System.currentTimeMillis();
        Database leftDb = databaseStructureLoader.loadDatabase(new DBConnectionConfig(
                // "MySQL",
                "", "3306", "", "", ""));
        Database rightDb = databaseStructureLoader.loadDatabase(new DBConnectionConfig(
                // "MySQL", 
                "", "3306", "", "", ""));
        log.info("加载表结构数据成功.... 耗时:{}ms", System.currentTimeMillis() - start);
        // 加载db结构
        start = System.currentTimeMillis();
        comparator.compare(leftDb, rightDb);
        log.info("比对数据库结构成功! 耗时:{}ms", System.currentTimeMillis() - start);
        
        log.info(displayer.getContent().toString());
    }
}
